package com.superhero.common.utils;

import com.superhero.common.exception.BusinessException;

import java.util.Optional;


public class OptionalUtil<T> {

    public static <T> T get(Optional<T> optional) {
        if (!optional.isPresent()) {
            throw new BusinessException("找不到该记录");
        }
        return optional.get();
    }
}
